package example.neon;

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class JPanelSettingContent extends JPanel {
    public JPanelCheckbox jPanelCheckboxRoom;
    public JPanelCheckbox jPanelCheckboxGun;
    public JPanelCheckbox jPanelCheckboxDance;

    public JPanelSettingContent() {
        int padding = 0;
        this.setBorder(BorderFactory.createEmptyBorder(padding, padding, 15, padding));
        this.setBackground(Color.WHITE);
        jPanelCheckboxDance = new JPanelCheckbox("自动跳舞机", "仅按WASD跳舞，其他啥也不做", true);
        jPanelCheckboxRoom = new JPanelCheckbox("自动连杆-钓鱼房", "钓到一条鱼后，马上按E继续钓鱼", false);
        jPanelCheckboxGun = new JPanelCheckbox("自动连杆-咸鱼枪", "钓到鱼马上按右键使用咸鱼枪钓鱼", false);
        this.add(createCheckBoxPanel(jPanelCheckboxDance));
        this.add(createCheckBoxPanel(jPanelCheckboxGun));
        this.add(createCheckBoxPanel(jPanelCheckboxRoom));
        jPanelCheckboxRoom.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                jPanelCheckboxDance.setIsCheck(false);
                jPanelCheckboxGun.setIsCheck(false);
            }
        });
        jPanelCheckboxGun.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                jPanelCheckboxDance.setIsCheck(false);
                jPanelCheckboxRoom.setIsCheck(false);
            }
        });
        jPanelCheckboxDance.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                jPanelCheckboxGun.setIsCheck(false);
                jPanelCheckboxRoom.setIsCheck(false);
            }
        });
        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    }

    public JPanel createCheckBoxPanel(JPanelCheckbox jPanelCheckbox) {
        JPanel jPanel = new JPanel();
        jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.X_AXIS));
        jPanel.setBackground(Color.WHITE);
        jPanel.add(jPanelCheckbox);
        return jPanel;
    }
}
